<%-- 
    Document   : book_list
    Created on : 2020-5-25, 12:34:25
    Author     : Lenovo
--%>

<%@page import="com.qdu.entity.Book"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link rel="stylesheet" href="css/bootstrap.min.css"/>
        <link rel="stylesheet" href="css/style.css"/>
        <link rel="shortcut icon" href="https://img3.doubanio.com/favicon.ico" type="image/x-icon">
        <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
        <script src="js/jquery-3.4.1.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script src="js/script3.js" charset="UTF-8"></script>
    </head>
    <body>

<!--        <nav class="navbar navbar-inverse">
            <div class="container-fluid btn-group-lg">
                 Brand and toggle get grouped for better mobile display 
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#">Brand</a>
                </div>

                 Collect the nav links, forms, and other content for toggling 
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
                        <li><a href="#">Link</a></li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="#">Action</a></li>
                                <li><a href="#">Another action</a></li>
                                <li><a href="#">Something else here</a></li>
                                <li role="separator" class="divider"></li>
                                <li><a href="#">Separated link</a></li>
                                <li role="separator" class="divider"></li>
                                <li><a href="#">One more separated link</a></li>
                            </ul>
                        </li>
                    </ul>
                    <form class="navbar-form navbar-left">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="Search">
                        </div>
                        <button type="submit" class="btn btn-default">Submit</button>
                    </form>
                    <ul class="nav navbar-nav navbar-right">
                        <li><a href="#">Link</a></li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="#">Action</a></li>
                                <li><a href="#">Another action</a></li>
                                <li><a href="#">Something else here</a></li>
                                <li role="separator" class="divider"></li>
                                <li><a href="#">Separated link</a></li>
                            </ul>
                        </li>
                    </ul>
                </div> /.navbar-collapse 
            </div> /.container-fluid 
        </nav>-->





        <div class="page-header">
            <h1>图书列表 <small>用于查看添加修改删除图书</small></h1>
        </div>
        <button type="button" class="btn btn-default btn-lg btn-success " id="btn_showAddModal" >
            <span class="glyphicon glyphicon-star" aria-hidden="true"></span>添加新图书
        </button>
        <div class="panel panel-primary">
            <!-- Default panel contents -->
            <div class="panel-heading">HELLO</div>
            <div class="panel-body">
                <p>这里显示已经存在的图书
                 <a class="btn btn-primary btn-sm" href="http://localhost:8084/J01_T05_P01/bu.jsp" role="button">返回</a></p>
            </div>


        </div>



        <div class="bookGallery" >
            <%

                List<Book> list = (List<Book>) request.getAttribute("all_books");
                session.setAttribute("list1", list);

            %>
            <c:forEach items="${sessionScope.list1}" var="b">

                <div class="text-center caption">
                    <a class="item" target="_blank" href="gbis?bId=${b.bId}">
                        <p>
                        <table class="table">
                            <!--中文名和评分-->
                            <tr id="tr${b.bId}">

                                <td><h4>${b.bId}</h4></td>

                                <td><h4>${b.bName}</h4></td>
<!--                                <td> <img src="images/${b.bCover}" alt="${b.bName}"> </td>-->
                                <td><h4>[${b.brating}]</h4></td>
                            </tr>
                        </table>
                    </a>
                    <br>
                    <p>   <a class=" btn btn-primary link_showAddModal glyphicon glyphicon-scissors"  role="button" href="javascript:showModifyModal('#tr${b.bId}');">编辑</a>&nbsp;&nbsp;&nbsp;&nbsp;
                        <a  class="btn btn-default glyphicon glyphicon-remove"  role="button" href="javascript:deleteBook('${b.bId}');">删除</a></p>
                    <br><br><br>
                </div>
            </c:forEach>

            <c:set var="item" value="2"/>


        </div>
        <div class="modal fade" id="add_modal" tabindex="-1">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title text-success" id="myModalLabel">添加新图书</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-inline" id="add_form">
                            <label for="ibId">书号：</label>
                            <input id="ibId" type="text" name="bId" placeholder="输入书号" class="form-control sinfo">
                            <br><br>
                            <label for="ibName">书名：</label>
                            <input id="ibName" type="text" name="bName" placeholder="输入书名" class="form-control sinfo">
<!--                            <br><br>
                            <label for="ibCover">封面：</label>
                            <input id="ibCover" type="text" name="bCover"  placeholder="图书封面" class="form-control sinfo">-->
                            <br><br>
                            <label for="ibrating">评分：</label>
                            <input id="ibrating" type="text" name="brating" placeholder="在此输入图书评分" class="form-control sinfo">

                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-warning" data-dismiss="modal">取消</button>
                        <button type="button" id="btn_add" class="btn btn-primary">保存添加</button>
                    </div>
                </div>
            </div>
        </div>

        <div class="modal fade" id="modify_modal" tabindex="-1">
            <div class="modal-dialog">
                <div class="bg-warn modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title text-danger" id="myModalLabel">编辑图书信息</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-inline" id="modify_form">
                            <label for="ibId">书号：</label>
                            <input id="ibId" readonly type="text" name="bId" class="form-control" >
                            <br><br>
                            <label for="ibName">书名：</label>
                            <input id="ibName" type="text" name="bName" class="form-control">
                            <br><br>
                            <label for="ibrating">评分：</label>
                            <input id="ibrating" type="text" name="brating" class="form-control">              
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-warning" data-dismiss="modal">取消</button>
                        <button type="button" id="btn_modify" class="btn btn-danger">保存修改</button>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>

